#[cfg(test)]
mod tests{
    use super::*;

    #[test]
    fn a(){
        assert_eq!(2+2, 4);
        assert_eq!(2+3, 5);
    }

    #[test]
    fn b(){
        assert_eq!(2+1, 3);
    }

    #[test]
    fn c(){
        assert!('1'.is_ascii());
    }

    #[test]
    fn d(){
        assert_ne!(3, 9+2);
    }
    #[test]
    fn e(){
        let r1 = Rect{
            w: 10,
            h: 10,
        };
        let r2 = Rect{
            w:8,
            h:8,
        };
        assert!(r1.can_hold(&r2));
    }

    #[test]
    fn f(){
        assert_ne!(8, 9);
    }

    #[test]
    fn g(){
        let result = greeting("Carol");
        assert!(result.contains("Carol"), "Greeting did not contain name, value was `{}`", result);
    }

    #[test]
    // #[should_panic]
    #[ignore]
    fn h(){
        Guess::new(19);
        // Guess::new(190);
    }

    #[test]
    #[ignore]
    fn it_works()->Result<(), String>{
        if 2+2==4{
            Ok(())
        }else {
            Err(String::from("assert is not correct..."))
        }
    }

}

#[derive(Debug)]
pub struct Rect{
    h: u32,
    w: u32,
}

impl Rect{
    pub fn can_hold(&self, oth: &Rect)->bool{
        return self.w > oth.w && self.h > oth.h;
    }
}

pub fn greeting(name: &str)->String{
    // String::from("Hello")
    format!("Hello {}", name)
}

#[allow(dead_code)]
pub struct Guess{
    value: u32,
}

impl Guess{
    pub fn new(val: u32)->Guess{
        if val<1 || val>100{
            panic!("panic haha...");
        }
        println!("The value equals: {}", val);
        Guess{
            value: val
        }
    }
}

pub fn add_two(x:i32) ->i32{
    x+2
}